package cn.itsource.org.controller;

import cn.itsource.basic.util.PageList;
import cn.itsource.org.domain.Department;
import cn.itsource.org.query.DepartmentQuery;
import cn.itsource.org.service.IDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("dept")
@Api(value="部门管理的接口文档",description ="部门管理的接口文档")
public class DeptController {
    @Autowired
    private IDepartmentService departmentService;
@ApiOperation(value = "高级分页查询",notes="高级分页查询")
@PostMapping("/findPage")
public PageList <Department> findPage(@RequestBody DepartmentQuery departmentQuery){
    return departmentService.queryData(departmentQuery);
}
    @ApiOperation(value = "单个查询",notes="单个查询")
    @GetMapping("/findOne")
    public Department findOne(Long id){
    return departmentService.loadById(id);

    }

    @ApiOperation(value = "单个删除",notes="单个删除")
    @GetMapping("/delete")
    public void delete(Long id){
        departmentService.remove(id);

    }
}
